<template>
	<view class="share">
		<view class="title">二维码分享</view>
		<view class="code_view">
			<uv-qrcode ref="qrcode" size="350rpx" value="https://h5.uvui.cn"></uv-qrcode>
		</view>
		<view class="title">链接分享</view>
		<view class="link_view">
			<view class="link_value">{{props.link}}</view>
			<view class="copy" @click="copy(props.link)">
				<image src="@/static/images/copy.png"></image>
			</view>
		</view>
	</view>
</template>

<script setup>
	import useBase from "@/hooks/useBase.js";
	const {
		copy
	} = useBase();
	const props = defineProps({
		link: String
	});
</script>

<style scoped lang="scss">
	.share {
		width: 690rpx;
		padding: 30rpx;
		box-sizing: border-box;

		.title {
			height: 94rpx;
			line-height: 94rpx;
			color: #333333;
			font-size: 36rpx;
			font-weight: bold;
			padding-left: 20rpx;
			box-sizing: border-box;
			position: relative;

			&::after {
				content: "";
				width: 8rpx;
				height: 34rpx;
				background: #CA1C1D;
				position: absolute;
				left: 0;
				top: 50%;
				transform: translateY(-50%);
			}
		}

		.code_view {
			width: 400rpx;
			height: 400rpx;
			margin: 10rpx auto 50rpx;
			background: #EEEEEE;
			display: flex;
			justify-content: center;
			align-items: center;


		}

		.link_view {
			padding: 0 10rpx 30rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.link_value {
				flex: 1;
				height: 80rpx;
				line-height: 80rpx;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				border-radius: 10rpx;
				padding: 0 25rpx;
				box-sizing: border-box;
				background: #EEEEEE;
			}

			.copy {
				width: 100rpx;
				height: 80rpx;
				border-radius: 10rpx;
				margin-left: 10rpx;
				background: #EEEEEE;
				display: flex;
				justify-content: center;
				align-items: center;

				image {
					width: 32rpx;
					height: 32rpx;
				}
			}
		}
	}
</style>